import { _decorator, Component, Label, Node } from 'cc';
import { UIManager } from '../common/UIManager';
import { PrefabEnum } from '../common/PrefabEnum';
import { Message } from '../entity/Message';
const { ccclass, property } = _decorator;

@ccclass('MessageDetail')
export class MessageDetail extends Component {
    @property(Node)
    mask:Node
    @property(Label)
    title:Label
    @property(Label)
    date:Label
    @property(Label)
    content:Label
    @property(Node)
    confirm:Node

    start() {
        this.mask.on(Node.EventType.TOUCH_END, this.onClose, this)
        this.confirm.on(Node.EventType.TOUCH_END, this.onClose, this)
    }

    setData(message:Message){
        this.title.string = message.title
        this.date.string = message.date
        this.content.string = message.desc
    }

    onClose(){
        UIManager.instance.closeUI(PrefabEnum.MessageDetail)
    }
}


